package org.noranj.server;

import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.noranj.server.Startup;
import org.noranj.webservice.ConversationWS;

public class Startup {
  //JAXRSServerFactoryBean SingletonResourceProvider
  
  protected Startup() throws Exception{
      
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
    sf.setResourceClasses(ConversationWS.class);
    sf.setResourceProvider(ConversationWS.class, new SingletonResourceProvider(new ConversationWS()));
    sf.setAddress("http://localhost:8080/");
    sf.create();
  }
  
  /**
   * @param args
   * @throws Exception
   */
  public static void main(String[] args) throws Exception{
    new Startup();
    System.out.println("Server ready...");
    Thread.sleep(5 * 60 * 10000);
    System.out.println("Server exiting");
    System.exit(0);
  }
}
